package com.hdjk.view.callback;

import com.hdjk.view.entity.IfastUserEntity;
import com.lst.projectlib.entity.Msg;

import org.json.JSONObject;

import okhttp3.Response;

/**
 * Created by sxy on 2017/11/2.
 */

public abstract class GetIfastUserInfoCallBack extends MsgCallBack {
    @Override
    public Msg parseNetworkResponse(Response response, int i) throws Exception {
        Msg msg = super.parseNetworkResponse(response, i);
        JSONObject object = (JSONObject) msg.getData();
        if (object!=null) {
            IfastUserEntity entity = new IfastUserEntity();
            if (!object.isNull("idNumber")) {
                entity.setIdNumber(object.getString("idNumber"));
            }
            if (!object.isNull("riskAppetite")) {
                entity.setRiskAppetite(object.getString("riskAppetite"));
            }
            msg.setData(entity);
        }
        return msg;
    }
}
